package com.teach.config;

import java.time.Duration;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import lombok.Data;

/**<pre>
 * 全局核心配置
 * Copyright 2022 jlzhou.top Inc. All rights reserved.
 * Warning: this content is only for internal circulation of the company.
 *          It is forbidden to divulge it or use it for other commercial purposes.
 * </pre>
 * @author J.L.Zhou
 * @since 2022年11月11日 下午3:14:10
 * @version 1.0
 */
@Configuration
@ConfigurationProperties(prefix = "com.teach")
@Data
public class ConfigProperties {
  private Boolean dev = false;
  private Integer workerId = 0;
  private Integer dataCenterId = 0;

  private Jwt jwt = new Jwt();

  /**
   * 阿里云OSS配置
   */
  public AliyunOss aliyunOss = new AliyunOss();

  /**
   * <pre>
   * 默认水印配置
   *  - classpath:/watermark.png 默认
   *  - /home/watermark.png 系统文件路径
   *  - https://xxx/xxx/watermark.png 网络上的图片
   * </pre>
   */
  public String watermark = "classpath:/watermark.png";

  @Data
  public static class Jwt {
    private String tokenName = "x-token";
    private Duration expire = Duration.ofDays(7);
    private byte[] key = "asdfsf_2&^T&*HIs".getBytes();
  }

  @Data
  public static class AliyunOss {
    public String endpoint = "oss-cn-shenzhen.aliyuncs.com";
    public String accessKeyId = "LTAI5t7KCHZ9H8obP7ZK5iWC";
    public String accessKeySecret = "1zFtBnkrRQqNMsQ4bUuF7P3AAIXr88";
    public String bucket = "test-data-resources";
    public String pre = "//test-data-resources.oss-cn-shenzhen.aliyuncs.com/";
  }
}
